//
//  NSError+Addition.m
//  Mobion Music
//
//  Created by Han Korea on 6/1/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "NSError+Addition.h"

@implementation NSError (Addition)
+ (NSError *)errorWithCode:(NSInteger)code description:(NSString *)description {
    switch (code) {
        case -1001: {
            description = @"Opps! A network timeout error occurred. Please try again later!";
            break;
        }
        case 10001:{
            description = @"SNS API have error!";
            break;
        }
        case 10002:{
            description = @"Opps! There are something wrongs with Facebook. Please try again later.";
            break;
        }
        case 10003:{
            description = @"Music Token Invalid!";
            break;
        }
        case 10004:{
            description = @"Parameter(s) invalid!";
            break;
        }
        case 10005:{
            description = @"Missing Param!";
            break;
        }
        case 10006:
        {
            description = @"There are something went wrong with share system, please try again later.";
            break;
        }
        case 11001:{
            description = @"Exceed total song in playlist!";
            break;
        }
        case 11002:{
            description = @"Opps! No songs found! Please try another!";
            break;
        }
        case 11003:{
            description = @"Song do not have in playlist!";
            break;
        }
        case 11004:{
            description = @"Opps! You cannot favorite this song right now, please try later!";
            break;
        }
        case 11005:{
            description = @"Opps! You cannot unfavorite this song right now, please try later!";
            break;
        }
        case 11007:{
            description = @"You have already favorited this song.";
            break;
        }
        case 11008:{
            description = @"You have not favorite this song yet.";
            break;
        }
        case 11009:{
            description = @"Opps! Something went wrong so you cannot comment on this song! Please try again later!";
            break;
        }
        case 12001:{
            description = @"Opps! No artists found! Please try with another!";
            break;
        }
        case 12002:{
            description = @"Opps! You cannot favorite this artist right now. Please try later!";
            break;
        }
        case 12003:{
            description = @"Opps! You cannot unfavorite this artist right now. Please try later!";
            break;
        }
        case 12004:{
            description = @"You have already favorited this artist.";
            break;
        }
        case 12005:{
            description = @"You have not favorited this artist yet.";
            break;
        }
        case 13001:
        {
            description = @"Opps! No albums found! Please try another.";
            break;
        }
        case 13002:
        {
            description = @"Opps! You cannot favorite this album right now. Please try later!";
            break;
        }
        case 13003:
        {
            description = @"Opps! You cannnot unfavorite this album right now. Please try later!";
            break;
        }
        case 13004:
        {
            description = @"You have already favorited this album.";
            break;
        }
        case 13005:
        {
            description = @"You have not favorite this album yet.";
            break;
        }
        case 14001:{
            description = @"You cannot delete this playlist right now, please try later!";
            break;
        }
        case 14002:{
            description = @"You cannot update this playlist right now, please try later!";
            break;
        }
        case 14003:{
            description = @"Opps! No playlists found! Please try another.";
            break;
        }
        case 14004:{
            description = @"Exceed total number playlist!";
            break;
        }
        case 14005:{
            description = @"You don't have permission to delete this playlist.";
            break;
        }
        case 14006:{
            description = @"You don't have permission to update this playlist.";
            break;
        }
        case 14007:{
            description = @"You can not favorite this playlist right now, please try later!";
            break;
        }
        case 14008:{
            description = @"You can not unfavorite this playlist right now, please try later!";
            break;
        }
        case 14012:{
            description = @"You have already favorited this playlist.";
            break;
        }
        case 14013:{
            description = @"You have not favorited this playlist yet.";
            break;
        }
        case 15001:{
            description = @"No Users found. Please try another!";
            break;
        }
        case 15002:{
            description = @"This email is not existing in the system. Please try another!";
            break;
        }
        case 15003:{
            description = @"Password does not match. Please try again!";
            break;
        }
        case 15004:
        case 15005:{
            description = @"Something went wrong, please try again later!";
            break;
        }
        case 15006:
        case 15007:{
            description = @"You cannot update account right now, please try later!";
            break;
        }
        
        case 15008:{
            description = @"Your password is invalid.";
            break;
        }
        case 15009:{
            description = @"Your email address is invalid.";
            break;
        }
        case 15010:{
            description = @"There is an existing account associated with this Facebook account. Please try another!";
            break;
        }
        case 15011:{
            description = @"Email Existed aready: There is an existing account associated with this email address.";
            break;
        }
        case -200:{
            description = @"Missing parameter!";
            break;
        }
        case -201:{
            description = @"Request method not found!";
            break;
        }
        case -202:{
            description = @"No method given!";
            break;
        }
        case -1009:
        {
            description = @"The Internet connection appears to be offline.";
            break;
        }
        default: 
            description = @"Our server is under construction.\n Please try again later.";
            break;
    }
    NSError *error = [NSError errorWithDomain:@"ZingBaseConnectionServiceDomain" 
                                         code:code
                                     userInfo:[NSDictionary dictionaryWithObject:description forKey:NSLocalizedDescriptionKey]];
    return error;
}


+ (NSError *)defaultError {
    NSError *error = [NSError errorWithCode:0 description:@"Our server is under construction. Please try again later."];
    return error;
}
@end
